package com.csii.pos.uofplan;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.pos.uofplan.service.PositionPlanQueryService;
import com.csii.result.APIResult;
import com.csii.result.PageVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description:资金头寸计划查询页面controller
 * @author:liuzhonghua
 * @create:2021.7.2
 */
@RestController
@Slf4j
@RequestMapping("/uofPlanQuery")
public class PositionPlanQueryController {
    @Resource
    private PositionPlanQueryService positionPlanQueryService;
    @RequestMapping("PositionPlanQuery")
    public APIResult positionPlanQuery(@RequestBody UofPlanPo uofPlanPo) {
        Page<UofPlanPo> page = new Page<>(uofPlanPo.getPageNo(), uofPlanPo.getPageSize());
        IPage<UofPlanPo> iPage = positionPlanQueryService.positionPlanQuery(page,uofPlanPo);
        PageVo pageVoFromIPage = PageVo.getPageVoFromIPage(iPage);
        APIResult<PageVo<UofPlanPo>> pageVoAPIResult = APIResult.successResult(pageVoFromIPage);
        return pageVoAPIResult;
    }
}
